#include <iostream>
#include <vector>
using namespace std;

// 找到转折点
int findTurning(vector<int>& v){
    int res = 1;
     // 每三个数一判断找到增减序列的分割数字
    for(size_t i = 1; i < v.size()-1; ++i){
        if(v[i-1] < v[i] && v[i+1] < v[i] || \
           v[i-1] > v[i] && v[i+1] > v[i]){
            res += 1;
            if(v.size()-3 != i) ++i;
        } 
    }
    return res;
}

int main()
{
    int n;
    while(cin >> n){
        vector<int> num(n);
        for(size_t i = 0; i < n; ++i)
            cin >> num[i];
        cout << findTurning(num) << endl;
    }
    return 0;
}